package com.myfum.wingplayer.model
{
	import com.myfum.wingplayer.entity.ProgramData;
	
	import flash.events.Event;
	import flash.events.EventDispatcher;
	import flash.events.IEventDispatcher;
	
	import mx.collections.ArrayCollection;
	
	import org.robotlegs.mvcs.Actor;
	
	[Bindable]
	public class ProgramLocator extends Actor implements IEventDispatcher
	{
		public function ProgramLocator()
		{
			dispatcher = new EventDispatcher();
		}
		
		private var dispatcher:EventDispatcher;
		
		public var day:int;
		public var arrayCollection:ArrayCollection;
		
		private var _currentProgram:ProgramData;
		
		public function set currentProgram(value:ProgramData):void{
			_currentProgram = value;
			dispatchEvent(new Event(Event.CHANGE));
		}
		
		[Bindable("change")]
		public function get currentProgram():ProgramData{
			return _currentProgram;
		}
		
		public function addEventListener(type:String, listener:Function, useCapture:Boolean=false, priority:int=0, useWeakReference:Boolean=false):void
		{
			dispatcher.addEventListener(type, listener, useCapture, priority, useWeakReference);
		}
		
		public function removeEventListener(type:String, listener:Function, useCapture:Boolean=false):void
		{
			dispatcher.removeEventListener(type, listener, useCapture);
		}
		
		public function dispatchEvent(event:Event):Boolean
		{
			return dispatcher.dispatchEvent(event);
		}
		
		public function hasEventListener(type:String):Boolean
		{
			return dispatcher.hasEventListener(type);
		}
		
		public function willTrigger(type:String):Boolean
		{
			return dispatcher.willTrigger(type);
		}
	}
}